3.2.41 \(\int \frac {\tanh ^2(c+d x)}{a+b \text {sech}^2(c+d x)} \, dx\) [141]

Optimal. Leaf size=46 \[ \frac {x}{a}-\frac {\sqrt {a+b} \tanh ^{-1}\left (\frac {\sqrt {b} \tanh (c+d x)}{\sqrt {a+b}}\right )}{a \sqrt {b} d} \]

[Out]

x/a-arctanh(b^(1/2)*tanh(d*x+c)/(a+b)^(1/2))*(a+b)^(1/2)/a/d/b^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.09, antiderivative size = 46, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {4226, 2000, 492, 212, 214} \begin {gather*} \frac {x}{a}-\frac {\sqrt {a+b} \tanh ^{-1}\left (\frac {\sqrt {b} \tanh (c+d x)}{\sqrt {a+b}}\right )}{a \sqrt {b} d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Tanh[c + d*x]^2/(a + b*Sech[c + d*x]^2),x]

[Out]

x/a - (Sqrt[a + b]*ArcTanh[(Sqrt[b]*Tanh[c + d*x])/Sqrt[a + b]])/(a*Sqrt[b]*d)

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 214

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x/Rt[-a/b, 2]], x] /; FreeQ[{a, b},
x] && NegQ[a/b]

Rule 492

Int[((e_.)*(x_))^(m_.)/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> Dist[(-a)*(e^n/(b*c -
 a*d)), Int[(e*x)^(m - n)/(a + b*x^n), x], x] + Dist[c*(e^n/(b*c - a*d)), Int[(e*x)^(m - n)/(c + d*x^n), x], x
] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && LeQ[n, m, 2*n - 1]

Rule 2000

Int[(u_)^(p_.)*(v_)^(q_.)*((e_.)*(x_))^(m_.), x_Symbol] :> Int[(e*x)^m*ExpandToSum[u, x]^p*ExpandToSum[v, x]^q
, x] /; FreeQ[{e, m, p, q}, x] && BinomialQ[{u, v}, x] && EqQ[BinomialDegree[u, x] - BinomialDegree[v, x], 0]
&&  !BinomialMatchQ[{u, v}, x]

Rule 4226

Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_), x_Symbol] :> With[
{ff = FreeFactors[Tan[e + f*x], x]}, Dist[ff/f, Subst[Int[(d*ff*x)^m*((a + b*(1 + ff^2*x^2)^(n/2))^p/(1 + ff^2
*x^2)), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, d, e, f, m, p}, x] && IntegerQ[n/2] && (IntegerQ[m/2] ||
EqQ[n, 2])

Rubi steps

\begin {align*} \int \frac {\tanh ^2(c+d x)}{a+b \text {sech}^2(c+d x)} \, dx &=\frac {\text {Subst}\left (\int \frac {x^2}{\left (1-x^2\right ) \left (a+b \left (1-x^2\right )\right )} \, dx,x,\tanh (c+d x)\right )}{d}\\ &=\frac {\text {Subst}\left (\int \frac {x^2}{\left (1-x^2\right ) \left (a+b-b x^2\right )} \, dx,x,\tanh (c+d x)\right )}{d}\\ &=\frac {\text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\tanh (c+d x)\right )}{a d}-\frac {(a+b) \text {Subst}\left (\int \frac {1}{a+b-b x^2} \, dx,x,\tanh (c+d x)\right )}{a d}\\ &=\frac {x}{a}-\frac {\sqrt {a+b} \tanh ^{-1}\left (\frac {\sqrt {b} \tanh (c+d x)}{\sqrt {a+b}}\right )}{a \sqrt {b} d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(174\) vs. \(2(46)=92\).
time = 0.24, size = 174, normalized size = 3.78 \begin {gather*} \frac {(a+2 b+a \cosh (2 (c+d x))) \text {sech}^2(c+d x) \left (\sqrt {a+b} d x \sqrt {b (\cosh (c)-\sinh (c))^4}+(a+b) \tanh ^{-1}\left (\frac {\text {sech}(d x) (\cosh (2 c)-\sinh (2 c)) ((a+2 b) \sinh (d x)-a \sinh (2 c+d x))}{2 \sqrt {a+b} \sqrt {b (\cosh (c)-\sinh (c))^4}}\right ) (-\cosh (2 c)+\sinh (2 c))\right )}{2 a \sqrt {a+b} d \left (a+b \text {sech}^2(c+d x)\right ) \sqrt {b (\cosh (c)-\sinh (c))^4}} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Tanh[c + d*x]^2/(a + b*Sech[c + d*x]^2),x]

[Out]

((a + 2*b + a*Cosh[2*(c + d*x)])*Sech[c + d*x]^2*(Sqrt[a + b]*d*x*Sqrt[b*(Cosh[c] - Sinh[c])^4] + (a + b)*ArcT
anh[(Sech[d*x]*(Cosh[2*c] - Sinh[2*c])*((a + 2*b)*Sinh[d*x] - a*Sinh[2*c + d*x]))/(2*Sqrt[a + b]*Sqrt[b*(Cosh[
c] - Sinh[c])^4])]*(-Cosh[2*c] + Sinh[2*c])))/(2*a*Sqrt[a + b]*d*(a + b*Sech[c + d*x]^2)*Sqrt[b*(Cosh[c] - Sin
h[c])^4])

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(143\) vs. \(2(38)=76\).
time = 2.45, size = 144, normalized size = 3.13

method result size
risch \(\frac {x}{a}+\frac {\sqrt {b \left (a +b \right )}\, \ln \left ({\mathrm e}^{2 d x +2 c}+\frac {2 \sqrt {b \left (a +b \right )}+a +2 b}{a}\right )}{2 b d a}-\frac {\sqrt {b \left (a +b \right )}\, \ln \left ({\mathrm e}^{2 d x +2 c}-\frac {2 \sqrt {b \left (a +b \right )}-a -2 b}{a}\right )}{2 b d a}\) \(104\)
derivativedivides \(\frac {\frac {2 \left (a +b \right ) \left (-\frac {\ln \left (\sqrt {a +b}\, \left (\tanh ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 \tanh \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {b}+\sqrt {a +b}\right )}{4 \sqrt {b}\, \sqrt {a +b}}+\frac {\ln \left (\sqrt {a +b}\, \left (\tanh ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-2 \tanh \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {b}+\sqrt {a +b}\right )}{4 \sqrt {b}\, \sqrt {a +b}}\right )}{a}-\frac {\ln \left (\tanh \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a}+\frac {\ln \left (\tanh \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a}}{d}\) \(144\)
default \(\frac {\frac {2 \left (a +b \right ) \left (-\frac {\ln \left (\sqrt {a +b}\, \left (\tanh ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 \tanh \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {b}+\sqrt {a +b}\right )}{4 \sqrt {b}\, \sqrt {a +b}}+\frac {\ln \left (\sqrt {a +b}\, \left (\tanh ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-2 \tanh \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {b}+\sqrt {a +b}\right )}{4 \sqrt {b}\, \sqrt {a +b}}\right )}{a}-\frac {\ln \left (\tanh \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a}+\frac {\ln \left (\tanh \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a}}{d}\) \(144\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tanh(d*x+c)^2/(a+b*sech(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(2/a*(a+b)*(-1/4/b^(1/2)/(a+b)^(1/2)*ln((a+b)^(1/2)*tanh(1/2*d*x+1/2*c)^2+2*tanh(1/2*d*x+1/2*c)*b^(1/2)+(a
+b)^(1/2))+1/4/b^(1/2)/(a+b)^(1/2)*ln((a+b)^(1/2)*tanh(1/2*d*x+1/2*c)^2-2*tanh(1/2*d*x+1/2*c)*b^(1/2)+(a+b)^(1
/2)))-1/a*ln(tanh(1/2*d*x+1/2*c)-1)+1/a*ln(tanh(1/2*d*x+1/2*c)+1))

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 291 vs. \(2 (38) = 76\).
time = 0.50, size = 291, normalized size = 6.33 \begin {gather*} -\frac {{\left (a + 2 \, b\right )} \log \left (\frac {a e^{\left (2 \, d x + 2 \, c\right )} + a + 2 \, b - 2 \, \sqrt {{\left (a + b\right )} b}}{a e^{\left (2 \, d x + 2 \, c\right )} + a + 2 \, b + 2 \, \sqrt {{\left (a + b\right )} b}}\right )}{8 \, \sqrt {{\left (a + b\right )} b} a d} + \frac {\log \left (\frac {a e^{\left (-2 \, d x - 2 \, c\right )} + a + 2 \, b - 2 \, \sqrt {{\left (a + b\right )} b}}{a e^{\left (-2 \, d x - 2 \, c\right )} + a + 2 \, b + 2 \, \sqrt {{\left (a + b\right )} b}}\right )}{4 \, \sqrt {{\left (a + b\right )} b} d} + \frac {{\left (a + 2 \, b\right )} \log \left (\frac {a e^{\left (-2 \, d x - 2 \, c\right )} + a + 2 \, b - 2 \, \sqrt {{\left (a + b\right )} b}}{a e^{\left (-2 \, d x - 2 \, c\right )} + a + 2 \, b + 2 \, \sqrt {{\left (a + b\right )} b}}\right )}{8 \, \sqrt {{\left (a + b\right )} b} a d} + \frac {\log \left (a e^{\left (4 \, d x + 4 \, c\right )} + 2 \, {\left (a + 2 \, b\right )} e^{\left (2 \, d x + 2 \, c\right )} + a\right )}{4 \, a d} - \frac {\log \left (2 \, {\left (a + 2 \, b\right )} e^{\left (-2 \, d x - 2 \, c\right )} + a e^{\left (-4 \, d x - 4 \, c\right )} + a\right )}{4 \, a d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(d*x+c)^2/(a+b*sech(d*x+c)^2),x, algorithm="maxima")

[Out]

-1/8*(a + 2*b)*log((a*e^(2*d*x + 2*c) + a + 2*b - 2*sqrt((a + b)*b))/(a*e^(2*d*x + 2*c) + a + 2*b + 2*sqrt((a
+ b)*b)))/(sqrt((a + b)*b)*a*d) + 1/4*log((a*e^(-2*d*x - 2*c) + a + 2*b - 2*sqrt((a + b)*b))/(a*e^(-2*d*x - 2*
c) + a + 2*b + 2*sqrt((a + b)*b)))/(sqrt((a + b)*b)*d) + 1/8*(a + 2*b)*log((a*e^(-2*d*x - 2*c) + a + 2*b - 2*s
qrt((a + b)*b))/(a*e^(-2*d*x - 2*c) + a + 2*b + 2*sqrt((a + b)*b)))/(sqrt((a + b)*b)*a*d) + 1/4*log(a*e^(4*d*x
 + 4*c) + 2*(a + 2*b)*e^(2*d*x + 2*c) + a)/(a*d) - 1/4*log(2*(a + 2*b)*e^(-2*d*x - 2*c) + a*e^(-4*d*x - 4*c) +
 a)/(a*d)

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 81 vs. \(2 (38) = 76\).
time = 0.44, size = 419, normalized size = 9.11 \begin {gather*} \left [\frac {2 \, d x + \sqrt {\frac {a + b}{b}} \log \left (\frac {a^{2} \cosh \left (d x + c\right )^{4} + 4 \, a^{2} \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + a^{2} \sinh \left (d x + c\right )^{4} + 2 \, {\left (a^{2} + 2 \, a b\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (3 \, a^{2} \cosh \left (d x + c\right )^{2} + a^{2} + 2 \, a b\right )} \sinh \left (d x + c\right )^{2} + a^{2} + 8 \, a b + 8 \, b^{2} + 4 \, {\left (a^{2} \cosh \left (d x + c\right )^{3} + {\left (a^{2} + 2 \, a b\right )} \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right ) + 4 \, {\left (a b \cosh \left (d x + c\right )^{2} + 2 \, a b \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + a b \sinh \left (d x + c\right )^{2} + a b + 2 \, b^{2}\right )} \sqrt {\frac {a + b}{b}}}{a \cosh \left (d x + c\right )^{4} + 4 \, a \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + a \sinh \left (d x + c\right )^{4} + 2 \, {\left (a + 2 \, b\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (3 \, a \cosh \left (d x + c\right )^{2} + a + 2 \, b\right )} \sinh \left (d x + c\right )^{2} + 4 \, {\left (a \cosh \left (d x + c\right )^{3} + {\left (a + 2 \, b\right )} \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right ) + a}\right )}{2 \, a d}, \frac {d x - \sqrt {-\frac {a + b}{b}} \arctan \left (\frac {{\left (a \cosh \left (d x + c\right )^{2} + 2 \, a \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + a \sinh \left (d x + c\right )^{2} + a + 2 \, b\right )} \sqrt {-\frac {a + b}{b}}}{2 \, {\left (a + b\right )}}\right )}{a d}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(d*x+c)^2/(a+b*sech(d*x+c)^2),x, algorithm="fricas")

[Out]

[1/2*(2*d*x + sqrt((a + b)/b)*log((a^2*cosh(d*x + c)^4 + 4*a^2*cosh(d*x + c)*sinh(d*x + c)^3 + a^2*sinh(d*x +
c)^4 + 2*(a^2 + 2*a*b)*cosh(d*x + c)^2 + 2*(3*a^2*cosh(d*x + c)^2 + a^2 + 2*a*b)*sinh(d*x + c)^2 + a^2 + 8*a*b
 + 8*b^2 + 4*(a^2*cosh(d*x + c)^3 + (a^2 + 2*a*b)*cosh(d*x + c))*sinh(d*x + c) + 4*(a*b*cosh(d*x + c)^2 + 2*a*
b*cosh(d*x + c)*sinh(d*x + c) + a*b*sinh(d*x + c)^2 + a*b + 2*b^2)*sqrt((a + b)/b))/(a*cosh(d*x + c)^4 + 4*a*c
osh(d*x + c)*sinh(d*x + c)^3 + a*sinh(d*x + c)^4 + 2*(a + 2*b)*cosh(d*x + c)^2 + 2*(3*a*cosh(d*x + c)^2 + a +
2*b)*sinh(d*x + c)^2 + 4*(a*cosh(d*x + c)^3 + (a + 2*b)*cosh(d*x + c))*sinh(d*x + c) + a)))/(a*d), (d*x - sqrt
(-(a + b)/b)*arctan(1/2*(a*cosh(d*x + c)^2 + 2*a*cosh(d*x + c)*sinh(d*x + c) + a*sinh(d*x + c)^2 + a + 2*b)*sq
rt(-(a + b)/b)/(a + b)))/(a*d)]

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\tanh ^{2}{\left (c + d x \right )}}{a + b \operatorname {sech}^{2}{\left (c + d x \right )}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(d*x+c)**2/(a+b*sech(d*x+c)**2),x)

[Out]

Integral(tanh(c + d*x)**2/(a + b*sech(c + d*x)**2), x)

________________________________________________________________________________________

Giac [A]
time = 1.16, size = 66, normalized size = 1.43 \begin {gather*} -\frac {\frac {{\left (a + b\right )} \arctan \left (\frac {a e^{\left (2 \, d x + 2 \, c\right )} + a + 2 \, b}{2 \, \sqrt {-a b - b^{2}}}\right )}{\sqrt {-a b - b^{2}} a} - \frac {d x + c}{a}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(d*x+c)^2/(a+b*sech(d*x+c)^2),x, algorithm="giac")

[Out]

-((a + b)*arctan(1/2*(a*e^(2*d*x + 2*c) + a + 2*b)/sqrt(-a*b - b^2))/(sqrt(-a*b - b^2)*a) - (d*x + c)/a)/d

________________________________________________________________________________________

Mupad [B]
time = 0.43, size = 105, normalized size = 2.28 \begin {gather*} \frac {x}{a}+\frac {\mathrm {atan}\left (\frac {\sqrt {-a^2\,b\,d^2}}{a\,d\,\sqrt {a+b}}+\frac {\sqrt {-a^2\,b\,d^2}}{2\,b\,d\,\sqrt {a+b}}+\frac {{\mathrm {e}}^{2\,c}\,{\mathrm {e}}^{2\,d\,x}\,\sqrt {-a^2\,b\,d^2}}{2\,b\,d\,\sqrt {a+b}}\right )\,\sqrt {a+b}}{\sqrt {-a^2\,b\,d^2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tanh(c + d*x)^2/(a + b/cosh(c + d*x)^2),x)

[Out]

x/a + (atan((-a^2*b*d^2)^(1/2)/(a*d*(a + b)^(1/2)) + (-a^2*b*d^2)^(1/2)/(2*b*d*(a + b)^(1/2)) + (exp(2*c)*exp(
2*d*x)*(-a^2*b*d^2)^(1/2))/(2*b*d*(a + b)^(1/2)))*(a + b)^(1/2))/(-a^2*b*d^2)^(1/2)

________________________________________________________________________________________